﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Admin.Models
{
    public class Company
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public string Domain { get; set; }
        public int CID { get; set; }
        public string Name { get; set; }
        public string DefaultVersion { get; set; }
        public string StartUp { get; set; }
        public int[] Versions { get; set; }
        [BsonDateTimeOptions(Kind= DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
        public string AssetLocation { get; set; }
    }

    public class Version
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public int VersionID { get; set; }
        public string VersionName { get; set; }
        public List<Page> Pages { get; set; }
        public string VersionHTML { get; set; }
        public List<Plugin> GlobalPlugins { get; set; }
        public bool IsDefault { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }

    public class Page
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public int PageID { get; set; }
        public string PageName { get; set; }
        public string VersionHTML { get; set; }
        public List<Plugin> Plugins { get; set; }
        public List<Include> FileIncludes { get; set; }
        public bool IsActive { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }

    public class Plugin
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public int PluginID { get; set; }
        public string PluginName { get; set; }
        public string Mode { get; set; }
        public List<Mode> Modes { get; set; }
        public bool IsActive { get; set; }
        public int SortOrder { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }
    
    public class Include
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public string FileName { get; set; }
        public string Type { get; set; }
        public int SortOrder { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }
    
    public class Mode
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public string ModeName { get; set; }       
        public bool IsActive { get; set; }
    }

    //public class Property
    //{
    //    public string PropertyName { get; set; }
    //    public string Key { get; set; }
    //    public string Value { get; set; }
    //}

}